<%--
  Created by IntelliJ IDEA.
  User: 88403
  Date: 2021/6/16
  Time: 21:55
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>教师管理</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        function deleteTeacher(tid){
            if(confirm("是否删除")){
                location.href="${pageContext.request.contextPath}/teachers/delete?tid="+tid;
            }
        }
    </script>
</head>
<body>
<%@include file="header.jsp"%>
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="index.jsp">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">教师管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
            </div>
        </div>
        <div class="result-wrap">

                <div class="result-title">
                    <div class="result-list">
                       <i class="icon-font"> <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal">新增教师</button></i>
<%--                        薪资模态框--%>
                        <div class="modal fade"  tabindex="-1" role="dialog" id="myModal">
                            <div class="modal-dialog" role="document" >
                                <div class="modal-content" style="height: 900px;width: 500px" >
                                    <div class="modal-header" >
                                        <button type="button" class="close" data-dismiss="modal">
                                            <span>&times;</span>
                                        </button>
                                        <h4 class="modal-title">添加教师</h4>
                                    </div>
                                    <form action="${pageContext.request.contextPath}/teachers/insert" method="post" enctype="multipart/form-data">
                                        <div class="motal-body" align="center" >

                                            <table class="result-tab">
                                                <tr><td>外教编号</td>
                                                    <td><input type="text" name="tnumber" ></td>
                                                </tr>
                                                <tr><td>性别</td>
                                                    <td><select name="tsex" >
                                                        <option selected></option>
                                                        <option>男</option>
                                                        <option>女</option>
                                                    </select></td>
                                                </tr>
                                                <tr><td>国籍</td>
                                                    <td>
                                                        <select name="tcountry">
                                                            <option selected></option><option>英国</option> <option>美国</option>
                                                            <option>加拿大</option><option>新西兰</option> <option>其他</option>
                                                        </select>
                                                    </td>
                                                </tr>
                                                <tr><td>教学经验</td>
                                                    <td>
                                                        <input type="text" name="texperience" >
                                                    </td>
                                                </tr>
                                                <tr><td>外教类型</td>
                                                    <td><select name="ttype">
                                                        <option selected></option><option>幼儿英语外教</option><option>青少年英语外教</option>
                                                        <option>成人英语外教</option><option>考试类外教</option><option>其他外教</option>
                                                    </select></td>
                                                </tr>
                                                <tr><td>中文水平</td>
                                                    <td><select name="tlevel">
                                                        <option selected></option><option>初级</option>
                                                        <option>中级</option> <option>高级</option>
                                                    </select>
                                                    </td>
                                                </tr>
                                                <tr><td>年龄</td>
                                                    <td><input type="text" name="tage" ></td>
                                                </tr>
                                                <tr><td>毕业院校</td>
                                                    <td><input type="text" name="tschool" ></td>
                                                </tr>
                                                <tr><td>学历</td>
                                                    <td><input type="text" name="tenducation" ></td>
                                                </tr>
                                                <tr><td>专业</td>
                                                    <td><input type="text" name="tmajor" ></td>
                                                </tr>
                                                <tr><td>资质</td>
                                                    <td><select name="toptitude">
                                                        <option selected></option><option>有</option><option>无</option>
                                                    </select></td>
                                                </tr>
                                                <tr><td>图片</td>
                                                    <td><input type="file" name="imge" accept="image/gif,image/jpeg,image/png,image/jpg"></td>
                                                </tr>
                                                <tr><td>简介</td>
                                                    <td><textarea name="tbrief" style="width: 300px;height: 200px"></textarea></td>
                                                </tr>

                                            </table>
                                            <input type="submit" value="提交">

                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
<%--                        模态框end--%>
<%--                        <a id="batchDel" href="javascript:void(0)"><i class="icon-font"></i>批量删除</a>--%>
<%--                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a>--%>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th>外教编号</th>
                            <th>性别</th>
                            <th>国籍</th>
                            <th>教学经验</th>
                            <th>外教类型</th>
                            <th>中文水平</th>
                            <th>年龄</th>
                            <th>毕业院校</th>
                            <th>学历</th>
                            <th>专业</th>
                            <th>资质</th>
                            <th>操作</th>

                        </tr>
                        <c:forEach items="${pi.list}" var="t" varStatus="a">
                            <tr>
                                <td>${t.tnumber}</td>
                                <td>${t.tsex}</td>
                                <td>${t.tcountry}</td>
                                <td>${t.texperience}</td>
                                <td>${t.ttype}</td>
                                <td>${t.tlevel}</td>
                                <td>${t.tage}</td>
                                <td>${t.tschool}</td>
                                <td>${t.tenducation}</td>
                                <td>${t.tmajor}</td>
                                <td>${t.toptitude}</td>
                                <td>
                                    <button onclick="deleteTeacher(${t.tid})" class="btn btn-danger btn-sm">删除</button>&nbsp;&nbsp;
                                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal${t.tid}">修改</button>
<%--                                   模态框--%>
                                    <div class="modal fade"  tabindex="-1" role="dialog" id="myModal${t.tid}">
                                        <div class="modal-dialog" role="document" >
                                            <div class="modal-content" style="height: 900px;width: 500px" >
                                                <div class="modal-header" >
                                                    <button type="button" class="close" data-dismiss="modal">
                                                        <span>&times;</span>
                                                    </button>
                                                    <h4 class="modal-title">修改教师信息</h4>
                                                </div>

                                                <form action="${pageContext.request.contextPath}/teachers/updete?tid=${t.tid}" method="post" enctype="multipart/form-data">
                                                    <div class="motal-body" align="center" >

                                                        <table>
                                                            <tr><td>外教编号</td>
                                                                <td><input type="text" name="tnumber" value="${t.tnumber}"></td>
                                                            </tr>
                                                            <tr><td>性别</td>
                                                                <td><select name="tsex" >
                                                                    <option selected>${t.tsex}</option>
                                                                    <option>男</option>
                                                                    <option>女</option>
                                                                </select></td>
                                                            </tr>
                                                            <tr><td>国籍</td>
                                                                <td>
                                                                    <select name="tcountry">
                                                                      <option selected>${t.tcountry}</option><option>英国</option> <option>美国</option>
                                                                        <option>加拿大</option><option>新西兰</option> <option>其他</option>
                                                                    </select>
                                                                </td>
                                                            </tr>
                                                            <tr><td>教学经验</td>
                                                                <td>
                                                                    <input type="text" name="texperience" value="${t.texperience}">
                                                                </td>
                                                            </tr>
                                                            <tr><td>外教类型</td>
                                                                <td><select name="ttype">
                                                                   <option selected>${t.ttype}</option><option>幼儿英语外教</option><option>青少年英语外教</option>
                                                                    <option>成人英语外教</option><option>考试类外教</option><option>其他外教</option>
                                                                </select></td>
                                                            </tr>
                                                            <tr><td>中文水平</td>
                                                                <td><select name="tlevel">
                                                                    <option selected>${t.tlevel}</option><option>初级</option>
                                                                    <option>中级</option> <option>高级</option>
                                                                </select>
                                                                </td>
                                                            </tr>
                                                            <tr><td>年龄</td>
                                                                <td><input type="text" name="tage" value="${t.tage}"></td>
                                                            </tr>
                                                            <tr><td>毕业院校</td>
                                                                <td><input type="text" name="tschool" value="${t.tschool}"></td>
                                                            </tr>
                                                            <tr><td>学历</td>
                                                                <td><input type="text" name="tenducation" value="${t.tenducation}"></td>
                                                            </tr>
                                                            <tr><td>专业</td>
                                                                <td><input type="text" name="tmajor" value="${t.tmajor}"></td>
                                                            </tr>
                                                            <tr><td>资质</td>
                                                                <td><select name="toptitude">
                                                                    <option selected>${t.toptitude}</option><option>有</option><option>无</option>
                                                                </select></td>
                                                            </tr>
                                                            <tr><td>图片</td>
                                                                <td><input type="file" name="imge" accept="image/gif,image/jpeg,image/png,image/jpg"></td>
                                                            </tr>
                                                            <tr><td>简介</td>
                                                                <td><textarea name="tbrief" style="width: 300px;height: 200px"></textarea></td>
                                                            </tr>

                                                        </table>
                                                        <input type="submit" value="提交">

                                                    </div>
                                                 </form>
                                            </div>
                                        </div>
                                    </div>
<%--                                    模态框end--%>
                                </td>

                            </tr>
                        </c:forEach>
                    </table>
                    <%--分页 后台传过来的分页集合为pi即可,路径根据需求修改--%>
                    <div class="Pages" align="center">
                        <span >目前在第<b>${pi.pageNum}</b>页,</span>
                        <span class="p_count">共有<b>${pi.pages}</b>页,</span>
                        <span class="p_total">本页共有<b>${pi.size}</b>条记录</span>
                        <span class="p_page">
                              <a href="${pageContext.request.contextPath}/teachers/select?pageNum=1" class="a_first">首页</a>
                           <c:if test="${pi.hasPreviousPage}">
                               <a href="${pageContext.request.contextPath}/teachers/select?pageNum=${pi.pageNum-1}" class="a_prev">上一页</a>
                           </c:if>
                            <c:forEach begin="1" end="${pi.pages}" var="index">
                                <c:if test="${pi.pageNum==index}">
                                    <li class="active" style="display: inline;">
                                        <a href="${pageContext.request.contextPath}/teachers/select?pageNum=${index}" style=" line-height: 20px;color: black; text-decoration: none;padding: 10px 10px;">${index}</a>
                                    </li>
                                </c:if>
                                <c:if test="${pi.pageNum!=index}">
                                    <li class="" style="display: inline;">
                                        <a href="${pageContext.request.contextPath}/teachers/select?pageNum=${index}" style=" line-height: 20px;color: black; text-decoration: none;padding: 10px 10px;">${index}</a>
                                    </li>
                                </c:if>
                            </c:forEach>

                            <c:if test="${pi.hasNextPage}">
                                <a href="${pageContext.request.contextPath}/teachers/select?pageNum=${pi.pageNum+1}" class="a_next">下一页</a>
                            </c:if>
                             <a href="${pageContext.request.contextPath}/teachers/select?pageNum=${pi.pages}" class="a_end">末页</a>
                          </span>
                    </div>
                    <%-- 分页end--%>
                </div>
        </div>
    </div>
</div>


</body>
</html>
